package com.woniuxy.store.core.mapper;

import com.woniuxy.store.core.model.MdSt;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author gmx
 * @since 2021-06-29
 */
public interface MdStMapper extends BaseMapper<MdSt> {

    @Update("UPDATE `md_st` SET `flag`=1 WHERE `st_id`=#{stId}")
    void delectOne(int stId);

    @Update("UPDATE `md_st` SET `flag`=CASE WHEN flag=0 THEN 1 ELSE 0 END  WHERE `store_id`=#{storeId} and third_id=#{thirdId}")
    void updateFlag(Integer storeId, Integer thirdId);

    @Select("select * from md_st where st_id = #{stId}")
    MdSt selectByIds(int stId);

}
